package com.khstudio.api.bitmapcache;

import android.graphics.Bitmap;


public class KhBitmapCacheParam<E> {
    static final char separatorChar = System.getProperty("file.separator", "/").charAt(0);;
    static final String separator = String.valueOf(separatorChar);

    private String  mPath;
    private Bitmap  mBitmap;
    private String  mDuration;
    private E       mParam;

    public KhBitmapCacheParam(String path, E param) {
        mPath   = path;
        mBitmap = null;
        mParam  = param;
    }

    public String getPath() { return mPath; };
    public String getKey() {
        int separatorIndex = mPath.lastIndexOf(separator);
        return (separatorIndex < 0) ? mPath : mPath.substring(separatorIndex + 1, mPath.length());
    }

    public Bitmap getBitmap() { return mBitmap; }
    public String getDuration() { return mDuration; }
    public E getParam() { return mParam; }

    public void setBitmap(Bitmap bm) { mBitmap = bm; }
    public void setDuration(String duration) { mDuration = duration; }
}
